package com.stargate.bd.bean;

public class Badge {

	public static final String TABLE_NAME = "BADGE";
	public static final String NUM_BADGE = "NumBadge";
	public static final String ETAT_BADGE = "EtatBadge";
	
	private int numBadge;
	private Etat etatBadge;

	public Badge(int numBadge, Etat etatBadge) {
		this.numBadge = numBadge;
		this.etatBadge = etatBadge;
	}

	public Badge(int numBadge) {
		this.numBadge = numBadge;
		etatBadge = Etat.ENABLE;
	}

	/**
	 * Constructeur utilisé pour la création en BD car le numéro de badge sera
	 * incrémenté automatique par la séquence seq_NumBadge. Le numéro de badge
	 * vaut alors -1.
	 * 
	 * @param etatBadge
	 */
	public Badge(Etat etatBadge) {
		numBadge = -1;
		this.etatBadge = etatBadge;
	}

	public int getNumBadge() {
		return numBadge;
	}

	public void setNumBadge(int numBadge) {
		this.numBadge = numBadge;
	}

	public Etat getEtatBadge() {
		return etatBadge;
	}

	public void setEtatBadge(Etat etatBadge) {
		this.etatBadge = etatBadge;
	}

	public void enable() {
		setEtatBadge(Etat.ENABLE);
	}
	
	public void disable() {
		setEtatBadge(Etat.DISABLE);
	}
	
	public boolean isEnable() {
		return etatBadge == Etat.ENABLE;
	}
	
	public boolean isDisable() {
		return etatBadge == Etat.DISABLE;
	}
	
	@Override
	public String toString() {
		return "Badge[" + numBadge + ", " + etatBadge + "]";
	}
}
